#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
int tree[N];
int arr[N];
int lower[N], higher[N];
int n;

int lowbit(int x)
{
	return x & -x;
}


void add(int x, int c)
{
	for (int i = x; i <= n; i += lowbit(i)) {
		tree[i] += c;
	}
}

int query(int x)
{
	int res = 0;
	for (int i = x; i; i -= lowbit(i)) {
		res += tree[i];
	}
	return res;
}
int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &arr[i]);
	}
	for (int i = 1; i <= n; i++) {
		int y = arr[i];
		higher[i] = query(n) - query(y);
		lower[i] = query(y - 1);
		add(y, 1);
	}
	LL res1 = 0, res2 = 0;
	memset(tree, 0, sizeof(tree));
	for (int i = n; i; i--) {
		int y = arr[i];
		res1 += higher[i] * (LL)(query(n) - query(y));
		res2 += lower[i] * (LL)(query(y - 1));
		add(y, 1);
	}
	cout << res1 << " " << res2 << endl;
	return 0;
}